<%@ page import="connect.InfoDao" %>
<%@ page import="connect.HttpRequest" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ReceiverUpdate</title>
</head>
<body onload="confirmwindow()">
<%-- 头部 --%>
<jsp:include page="top.jsp"/>
<section class="service_section layout_padding">
    <div class="container">
        <div class="heading_container">
            <h2>
                更新中... <br>
                请等待...
            </h2>
        </div>
    </div>
</section>

<%
    request.setCharacterEncoding("UTF-8");

    //获取页面参数
    //trade表示第几笔交易
    Integer trade = Integer.parseInt(request.getParameter("trade"));
    Integer org = Integer.parseInt(request.getParameter("org"));
    Integer status=2;

    //引入数据交互层
    InfoDao infoDao =new InfoDao();
    boolean flag = infoDao.updateStatusByTrade(trade,status);

    if (flag) {
        response.sendRedirect("receiver.jsp");
    } else {
        response.sendRedirect("error.jsp");
    }
    String s=new String();
    s+=trade*10;
    s+=",";
    s+=trade*10+1;
    s+=",";
    s+=trade*10+2;
    s+=",";
    s+=trade*10+3;
%>
<script>
    function confirmwindow(){
        <%
        if(org==1){
            String s1 = HttpRequest.sendGet("http://localhost:3000/callFabric/f9","l="+s);
            System.out.println(s1);
        }
        else if(org==2){
            String s2 = HttpRequest.sendGet("http://localhost:3000/callFabric/f10","l="+s);
            System.out.println(s2);
        }
        %>
    }
</script>
</body>
</html>
